import { Column, Entity, Index, OneToMany } from 'typeorm';
import { BaseEntity } from './baseentity';
import { AView } from './view.entity';
import { AScope } from './scope.entity';
import { AViewScope } from './viewscope.entity';
import { AProperty } from './property.entity';

@Entity()
export class ADesign extends BaseEntity {
  @Index({ unique: true })
  @Column({ nullable: false, length: 50 })
  name: string;

  @OneToMany(() => AView, (a) => a.design, { cascade: true })
  views: AView[];

  @OneToMany(() => AScope, (a) => a.design, { cascade: true })
  scopes: AScope[];

  @OneToMany(() => AViewScope, (a) => a.design, { cascade: true })
  viewscopes: AViewScope[];

  @OneToMany(() => AProperty, (a) => a.design, { cascade: true })
  propertys: AProperty[];
}
